<include file="Public/head" xmlns="http://www.w3.org/1999/html"/>
<include file="Public/common_header" />
<link type="text/css" rel="stylesheet" href="{:get_style_cdnurl()}paimai/yunying/css/cashier.css" />
<div class="mian">
    <include file="Public/sidebar" menu="clcwht.twjfddgl"  />
    <div class="mianR">
		<div class="yuyue">
			<ul>
				<li onclick="getList(1);" data-id="0" class="yuCurrent">已支付</li>
				<li onclick="getList(2);" id="returned" data-id="1">已退回</li>
			</ul>
		</div>
		<form id="searchFrom">
            <div class="yuSuo clearfix">
                <div id="search1">
                    <input type="text" class="suoDian" id="ord_num" name="article_title" placeholder="请输入订单号" value="">
                    <input type="text" class="suoDian" id="question_id" name="article_title" placeholder="请输入问题ID" value="">
                    <input type="text" class="suoDian" id="user_id" name="article_title" placeholder="请输入提问用户ID" value="">
                    <input type="text" class="suoDian" id="nick_name" name="article_title" placeholder="请输入提问用户" value="">
                    <span>&nbsp;&nbsp;&nbsp;</span>
                    <input readonly type="text" class="" id="start_time" name="start_time" placeholder="订单开始时间"/>
                    <em></em>
                    <input readonly type="text" class="" id="end_time" name="end_time" placeholder="订单结束时间"/>
                </div>
                <input type="button" onclick="searchList();" id="search" value="搜索" class="suoSou">
            </div>
        </form>
		<div class="listBox" id="listBox">
			<div class="yuList">
			</div>
			
			<div class="yuList" style="display:none;">
			</div>
		</div>
		
		<!--退单弹出窗口-->
        <div class="tanShang return_exchange" style="display:none;">
            <h3>退回提问积分</h3>
            <ul class="daiJingW">
                <li class="convert_info">
                    <span>提问用户：</span>
                    <em id="return_user_name"></em>
                </li>
                <li class="convert_info">
                    <span>订单积分：</span>
                    <em id="return_score"></em>
                </li>
                <li class="clearfix tipmsg"></li>
                <li class="clearfix">
                    <input type="hidden" name="con_id" id="con_id">
                    <input type="button" value="确定" class="queding" onclick="returnScore();" id="returnScore"/>
                    <input type="button" value="取消" class="quxiao"/>
                </li>
            </ul>
        </div>
		<div class="clear"></div>
	</div>
</div>
<script>
var status = 1;
getData(1);

function getData(page,params){

	if(!params){
		params = {};
	}
	
	params.p = page;
	params.status = status;
	
	$.get('/Score/getOrderList',params, function(data){
		if(status == 1){
			$('.yuList').eq(0).html(data);
		}else{
			$('.yuList').eq(1).html(data);
		}
	});
}
function getList(s){
	status = s;
	getData(1);
}

function get_page(page){
	getData(page);
}

function searchList(){
	var data = {
		'ord_num' : $('#ord_num').val(),
		'question_id' : $('#question_id').val(),
		'user_id' : $('#user_id').val(),
		'nick_name' : $('#nick_name').val(),
		'start_time' : $('#start_time').val(),
		'end_time' : $('#end_time').val()
	};
	
	getData(1, data);
}

$("#start_time").ymdateplugin({
	showTimePanel: true,
	changeMonth: true,
	changeYear: true
});

$("#end_time").ymdateplugin({
	showTimePanel: true,
	changeMonth: true,
	changeYear: true
});


function returnUserScore(id,user,score) {
	
	$("#return_user_name").html(user);
    $("#return_score").html(score);
	$("input[name='con_id']").val(id);
	$('.return_exchange').show();
}


function returnScore(){
	var id = $('#con_id').val();
	if(!id){
		alert('非法操作');
		return false;
	}
	
	$.get('/Score/returnScore', {id:id}, function(data){
		if(data.code == 200){
			alert('积分退回成功');
			window.location = window.location.href;
		}else{
			alert('积分退回失败');
		}
		
	},'json');
}



</script>
<include file="Public/foot" />